﻿using Shop.RemoteModel.LogisticsTemplate;
using Shop.RemoteModel.LogisticsTemplate.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class LogisticsTemplateEvent : IRpcApiService
    {
        private readonly ILogisticsTemplateService _Service;

        public LogisticsTemplateEvent (ILogisticsTemplateService service)
        {
            this._Service = service;
        }

        public long AddLogisticsTemplate (AddLogisticsTemplate add)
        {
            return this._Service.Add(add.Datum);
        }
        public bool SetLogisticsTemplate (SetLogisticsTemplate obj)
        {
            return this._Service.Set(obj.Id, obj.Datum);
        }
        public LTemplateDatum GetLogisticsTemplate (GetLogisticsTemplate obj)
        {
            return this._Service.Get(obj.Id);
        }
        public LogisticsItem[] GetLogisticsItems ()
        {
            return this._Service.GetItems();
        }
        public void DeleteLogisticsTemplate (DeleteLogisticsTemplate obj)
        {
            this._Service.Delete(obj.Id);
        }
        public bool SetLTemplateIsEnable (SetLTemplateIsEnable obj)
        {
            return this._Service.SetIsEnable(obj.Id, obj.IsEnable);
        }
        public long SetLTemplateDefault (SetLTemplateDefault obj)
        {
            return this._Service.SetIsDefault(obj.Id);
        }
        public PagingResult<LTemplateDatum> QueryLogisticsTemplate (QueryLogisticsTemplate obj)
        {
            return this._Service.Query(obj.QueryParam, obj.ToBasicPage());
        }
    }
}
